package com.example.booksystem.demos.web.service;

import com.example.booksystem.demos.web.model.Book;
import com.example.booksystem.demos.web.dao.bookDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


import java.util.List;

@Component
public class bookService {

    @Autowired
    private bookDao dao;
    public List<Book> getBookList(){
        System.out.println("doGetBookList");
        List<Book> list = dao.mockData(15);
        for (int i = 0; i < list.size(); i++) {
            Book book = list.get(i);
            if(1==book.getStatus()){
                book.setStatusCN("可借阅");
            }else if (2==book.getStatus()){
                book.setStatusCN("不可借阅");
            }else {
                book.setStatusCN("无状态");
            }
        }
        return list;
    }
}
